var _pInfo = {
	"sign": null,
	"userInfo": null,
	"mywalletInfo": null,
	"walletListInfo": null,
	"param": getQueryParams(),
	"renderData": function() {
		AjaxRequest({
			url: _url + "/money/wallet/mywallet",
			type: "post",
			load: true,
			async: false,
			data: {
				"userid": _pInfo.userInfo["id"]
			},
			success: function(rs) {
				if(isReqSucceed(rs)) {
					_pInfo.mywalletInfo = rs.data;
				}
			}
		});
		AjaxRequest({
			url: _url + "/money/wallet/verifysignature",
			type: "post",
			load: true,
			async: false,
			data: {
				"userid": _pInfo.userInfo["id"]
			},
			success: function(rs) {
				if(isReqSucceed(rs)) {
					_pInfo.sign = rs.data;
				}
			}
		});
		AjaxRequest({
			url: _url + "/money/wallet/yunaccountlog",
			type: "post",
			load: true,
			async: false,
			data: {
				"userid": _pInfo.userInfo["id"],
				"moneyType": _pInfo.param["type"]
			},
			success: function(rs) {
				if(isReqSucceed(rs)) {
					_pInfo.walletListInfo = rs.data;
					$("#wallet-content").html(template("wallet-content-tpl", {
						rs: rs.data,
						type: _pInfo.param["type"],
						mwInfo: _pInfo.mywalletInfo
					}));
				}
			}
		});
	},
	"rechargeAndWithdraw": function() {
		$.actions({
			actions: [{
				text: "充币",
				className: "action-color-blue",
				onClick: function() {
<<<<<<< HEAD
					WalletInteractive.rechargeUidToken(_pInfo.userInfo["id"], _pInfo["sign"]);
=======
					rechargeUidToken(_pInfo.userInfo["id"], _pInfo["sign"]);
>>>>>>> c7b8bb0815e40561f3df48818c02bb58d1b1c469
					//window.location.href = "recharge-withdraw.html?type=cz";
				}
			}, {
				text: "提币",
				className: "action-color-orange",
				onClick: function() {
<<<<<<< HEAD
					//WalletInteractive.withdrawUidToken(_pInfo.userInfo["id"], _pInfo["sign"]);
					window.location.href = "recharge-withdraw.html?type=tx";
=======
					withdrawUidToken(_pInfo.userInfo["id"], _pInfo["sign"]);
					//window.location.href = "recharge-withdraw.html?type=tx";
>>>>>>> c7b8bb0815e40561f3df48818c02bb58d1b1c469
				}
			}]
		});
	},
	"loadEvents": function() {
		_pInfo.userInfo = _user.getUserInfo();
	},
	"load": function() {
		this.loadEvents();
		this.renderData();
	}
}
exposeGlobalMethods({
	"rechargeAndWithdraw": function() {
		_pInfo.rechargeAndWithdraw();
	}
});
$(function() {
	_pInfo.load();
});

//upAccount充值/提现、transfer转账、millIncome挖矿收入、buyMill购买矿机
function formatLogType(i) {
	var logType = _pInfo["walletListInfo"][i].logType;
	var type = _pInfo["walletListInfo"][i].type;
	var dockingName = _pInfo["walletListInfo"][i].dockingName;
	var logStatus = _pInfo["walletListInfo"][i].logStatus;
	switch(logType) {
		case "upAccount": //记录状态：0等待中、1成功、2失败
			var str = "";
			if(logStatus == 0) {
				str = "等待中";
			} else if(logStatus == 1) {
				str = "交易成功";
			} else if(logStatus == 2) {
				str = "交易失败";
			}
			return "充值/提现"
			break;
		case "transfer":
			var str = "";
			if(type == 0) {
				str = "转账给" + dockingName;
			} else {
				str = "来自" + dockingName + "的转账";
			}
			return str;
			break;
		case "millIncome":
			return "挖矿收入";
			break;
		case "buyMill":
			return "购买矿机";
			break;
		default:
			break;
	}
}

function formatLogStatus(i) {
	var logType = _pInfo["walletListInfo"][i].logType;
	var logStatus = _pInfo["walletListInfo"][i].logStatus;
	switch(logType) {
		case "upAccount": //记录状态：0等待中、1成功、2失败
			var str = "";
			if(logStatus == 0) {
				str = "等待中";
			} else if(logStatus == 1) {
				str = "交易成功";
			} else if(logStatus == 2) {
				str = "交易失败";
			}
			return str;
			break;
		default:
			return "交易成功";
			break;
	}
}